﻿CREATE TABLE [CO].[MedForm] (
    [Id]        INT           NOT NULL,
    [Name]      VARCHAR (100) NOT NULL,
    [ShortName] VARCHAR (50)  NOT NULL,
    [Note]      VARCHAR (250) NULL,
    [MD]        DATETIME      CONSTRAINT [DF__MedForm__MD__6501FCD8] DEFAULT (getdate()) NOT NULL,
    [MW]        VARCHAR (50)  CONSTRAINT [DF__MedForm__MW__65F62111] DEFAULT (suser_sname()) NOT NULL,
    [ToDelete]  BIT           DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_MedForm] PRIMARY KEY CLUSTERED ([Id] ASC)
);


GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_MedForm_Name]
    ON [CO].[MedForm]([Name] ASC);


GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_MedForm_ShortName]
    ON [CO].[MedForm]([ShortName] ASC);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Признак того, что запись нужно удалить из БД всех подразделений', @level0type = N'SCHEMA', @level0name = N'CO', @level1type = N'TABLE', @level1name = N'MedForm', @level2type = N'COLUMN', @level2name = N'ToDelete';

